<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Invoke CCL Parser</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.yaz-ccl-conf.html">yaz_ccl_conf</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.yaz-close.html">yaz_close</a></div>
 <div class="up"><a href="ref.yaz.html">YAZ 函数</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="function.yaz-ccl-parse" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">yaz_ccl_parse</h1>
  <p class="verinfo">(PHP 4 &gt;= 4.0.5, PECL yaz &gt;= 0.9.0)</p><p class="refpurpose"><span class="refname">yaz_ccl_parse</span> &mdash; <span class="dc-title">Invoke CCL Parser</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-function.yaz-ccl-parse-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="type">bool</span> <span class="methodname"><strong>yaz_ccl_parse</strong></span>
    ( <span class="methodparam"><span class="type">resource</span> <code class="parameter">$id</code></span>
   , <span class="methodparam"><span class="type">string</span> <code class="parameter">$query</code></span>
   , <span class="methodparam"><span class="type">array</span> <code class="parameter reference">&$result</code></span>
   )</div>

  <p class="para rdfs-comment">
   This function invokes a CCL parser. It converts a given CCL FIND query to
   an RPN query which may be passed to the <span class="function"><a href="function.yaz-search.html" class="function">yaz_search()</a></span> 
   function to perform a search.
  </p>
  <p class="para">
   To define a set of valid CCL fields call <span class="function"><a href="function.yaz-ccl-conf.html" class="function">yaz_ccl_conf()</a></span> 
   prior to this function.
  </p>
 </div>

 <div class="refsect1 parameters" id="refsect1-function.yaz-ccl-parse-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>

    
     <dt>
<em><code class="parameter">id</code></em></dt>

     <dd>

      <p class="para">
       The connection resource returned by <span class="function"><a href="function.yaz-connect.html" class="function">yaz_connect()</a></span>.
      </p>
     </dd>

    
    
     <dt>
<em><code class="parameter">query</code></em></dt>

     <dd>

      <p class="para">
       The CCL FIND query.
      </p>
     </dd>

    
    
     <dt>
<em><code class="parameter">result</code></em></dt>

     <dd>

      <p class="para">
       If the function was executed successfully, this will be an array 
       containing the valid RPN query under the key <em>rpn</em>.
      </p>
      <p class="para">
       Upon failure, three indexes are set in this array to indicate the cause
       of failure: 
       <ul class="itemizedlist">
        <li class="listitem">
         <p class="para">
          <em>errorcode</em> - the CCL error code (integer)
         </p>
        </li> 
        <li class="listitem">
         <p class="para">
          <em>errorstring</em> - the CCL error string
         </p>
        </li> 
        <li class="listitem">
         <p class="para">
          <em>errorpos</em> - approximate position in query of failure
          (integer is character position)
         </p>
        </li> 
       </ul>
      </p>
     </dd>

    
   </dl>

  </p>
 </div>

 <div class="refsect1 returnvalues" id="refsect1-function.yaz-ccl-parse-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   成功时返回 <strong><code>TRUE</code></strong>， 或者在失败时返回 <strong><code>FALSE</code></strong>。
  </p>
 </div>

 <div class="refsect1 examples" id="refsect1-function.yaz-ccl-parse-examples">
  <h3 class="title">范例</h3>
  <div class="example" id="example-4582">
   <p><strong>Example #1 CCL Parsing</strong></p>
   <div class="example-contents"><p>
    We will try to search using CCL. In the example below,  
    <em>$ccl</em> is a CCL query. 
   </p></div>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /><br />yaz_ccl_conf</span><span style="color: #007700">(</span><span style="color: #0000BB">$id</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$fields</span><span style="color: #007700">);&nbsp;&nbsp;</span><span style="color: #FF8000">//&nbsp;see&nbsp;example&nbsp;for&nbsp;yaz_ccl_conf<br /></span><span style="color: #007700">if&nbsp;(!</span><span style="color: #0000BB">yaz_ccl_parse</span><span style="color: #007700">(</span><span style="color: #0000BB">$id</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$ccl</span><span style="color: #007700">,&nbsp;&amp;</span><span style="color: #0000BB">$cclresult</span><span style="color: #007700">))&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">'Error:&nbsp;'&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">$cclresult</span><span style="color: #007700">[</span><span style="color: #DD0000">"errorstring"</span><span style="color: #007700">];<br />}&nbsp;else&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$rpn&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$cclresult</span><span style="color: #007700">[</span><span style="color: #DD0000">"rpn"</span><span style="color: #007700">];<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">yaz_search</span><span style="color: #007700">(</span><span style="color: #0000BB">$id</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"rpn"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$rpn</span><span style="color: #007700">);<br />}<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
   </div>

  </div>
 </div>

</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.yaz-ccl-conf.html">yaz_ccl_conf</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.yaz-close.html">yaz_close</a></div>
 <div class="up"><a href="ref.yaz.html">YAZ 函数</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
